package com.ruoyi.carrepair.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.carrepair.mapper.QxMxPeijianMapper;
import com.ruoyi.carrepair.domain.QxMxPeijian;
import com.ruoyi.carrepair.service.IQxMxPeijianService;

/**
 * 配件明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-19
 */
@Service
public class QxMxPeijianServiceImpl implements IQxMxPeijianService 
{
    @Autowired
    private QxMxPeijianMapper qxMxPeijianMapper;

    /**
     * 查询配件明细
     * 
     * @param id 配件明细主键
     * @return 配件明细
     */
    @Override
    public QxMxPeijian selectQxMxPeijianById(String id)
    {
        return qxMxPeijianMapper.selectQxMxPeijianById(id);
    }

    /**
     * 查询配件明细列表
     * 
     * @param qxMxPeijian 配件明细
     * @return 配件明细
     */
    @Override
    public List<QxMxPeijian> selectQxMxPeijianList(QxMxPeijian qxMxPeijian)
    {
        List<QxMxPeijian> list = qxMxPeijianMapper.selectQxMxPeijianList(qxMxPeijian);
        for(QxMxPeijian item:list){
            if(item.getNotselectdata()!=null && item.getNotselectdata() == 1){
                item.setPjpid(item.getMxpjid());
                item.setPname(item.getMxpname());
                item.setChexing(item.getMxchexing());
            }
        }
        return list;
    }

    /**
     * 新增配件明细
     * 
     * @param qxMxPeijian 配件明细
     * @return 结果
     */
    @Override
    public int insertQxMxPeijian(QxMxPeijian qxMxPeijian)
    {

        return qxMxPeijianMapper.insertQxMxPeijian(qxMxPeijian);
    }

    /**
     * 修改配件明细
     * 
     * @param qxMxPeijian 配件明细
     * @return 结果
     */
    @Override
    public int updateQxMxPeijian(QxMxPeijian qxMxPeijian)
    {
        return qxMxPeijianMapper.updateQxMxPeijian(qxMxPeijian);
    }

    /**
     * 批量删除配件明细
     * 
     * @param ids 需要删除的配件明细主键
     * @return 结果
     */
    @Override
    public int deleteQxMxPeijianByIds(String[] ids)
    {
        return qxMxPeijianMapper.deleteQxMxPeijianByIds(ids);
    }

    /**
     * 删除配件明细信息
     * 
     * @param id 配件明细主键
     * @return 结果
     */
    @Override
    public int deleteQxMxPeijianById(String id)
    {
        return qxMxPeijianMapper.deleteQxMxPeijianById(id);
    }
}
